package com.glacier.yuyuan.modules.admin.sys.domain;

import com.glacier.common.core.domain.BaseEntity;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * date 2022-11-10 13:00
 * 角色表
 *
 * @author glacier
 * @version 1.0
 */
public class Role extends BaseEntity {
    private static final long serialVersionUID = 6771942507028669838L;
    /**
     * 编码
     */
    private String code;

    /**
     * 名称
     */
    private String name;

    /**
     * 单位
     */
    private String officeId;

    /**
     * 单位
     */
    private String officeTitle;

    /**
     * 角色类型
     */
    private String roleType;

    /**
     * 数据权限
     */
    private String dataScope;

    /**
     * 状态
     */
    private String status;

    /**
     * 失效时间
     */
    private LocalDateTime expireTime;

    /**
     * 菜单
     */
    private List<String> menuIdList;


    /**
     * 机构
     */
    private List<String> officeIdList;

    public Role() {
    }

    public Role(String id) {
        super(id);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOfficeId() {
        return officeId;
    }

    public void setOfficeId(String officeId) {
        this.officeId = officeId;
    }

    public String getOfficeTitle() {
        return officeTitle;
    }

    public void setOfficeTitle(String officeTitle) {
        this.officeTitle = officeTitle;
    }

    public String getRoleType() {
        return roleType;
    }

    public void setRoleType(String roleType) {
        this.roleType = roleType;
    }

    public String getDataScope() {
        return dataScope;
    }

    public void setDataScope(String dataScope) {
        this.dataScope = dataScope;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public LocalDateTime getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(LocalDateTime expireTime) {
        this.expireTime = expireTime;
    }

    public List<String> getMenuIdList() {
        return Optional.ofNullable(menuIdList)
                .orElseGet(() -> menuIdList = new ArrayList<>(8));
    }

    public void setMenuIdList(List<String> menuIdList) {
        this.menuIdList = menuIdList;
    }

    public List<String> getOfficeIdList() {
        return Optional.ofNullable(officeIdList)
                .orElseGet(() -> officeIdList = new ArrayList<>(8));
    }

    public void setOfficeIdList(List<String> officeIdList) {
        this.officeIdList = officeIdList;
    }

    @Override
    public String toString() {
        return "Role{" +
                "code='" + code + '\'' +
                ", name='" + name + '\'' +
                ", officeId='" + officeId + '\'' +
                ", officeTitle='" + officeTitle + '\'' +
                ", roleType='" + roleType + '\'' +
                ", dataScope='" + dataScope + '\'' +
                ", status='" + status + '\'' +
                ", expireTime=" + expireTime +
                ", id='" + id + '\'' +
                ", createBy='" + createBy + '\'' +
                ", createTime=" + createTime +
                ", updateBy='" + updateBy + '\'' +
                ", updateTime=" + updateTime +
                ", remark='" + remark + '\'' +
                ", menuIds='" + menuIdList + '\'' +
                ", officeIds='" + officeIdList + '\'' +
                '}';
    }
}
